/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2019
 */

package net.dreamlu.db.po;


import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;


import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
 *
 * @author lambert.wang email:lambert.wang(a)crediteyes.com
 * @version 1.0
 * @since 1.0
 */
@Data
@Slf4j
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_role_resource")
public class RoleResource implements Serializable {
	private static final long	serialVersionUID	= 5454155825314635342L;
	//alias
	public static final String TABLE_ALIAS = "RoleResource";
	public static final String ALIAS_ID = "主键id";
	public static final String ALIAS_ROLE_ID = "角色id";
	public static final String ALIAS_RESOURCE_ID = "资源id";
	
	public static final String PROP_ID = "id";
	public static final String PROP_ROLE_ID = "roleId";
	public static final String PROP_RESOURCE_ID = "resourceId";
	//columns START
    /**
     * 主键id       db_column: id 
     */ 	
	@Id 
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	private java.lang.Integer id;
    /**
     * 角色id       db_column: role_id 
     */ 	
	@Column(name = "role_id", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
	private java.lang.Integer roleId;
    /**
     * 资源id       db_column: resource_id 
     */ 	
	@Column(name = "resource_id", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
	private java.lang.Integer resourceId;
	//columns END
	@Override
	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.JSON_STYLE)
			.append(PROP_ID,getId())
			.append(PROP_ROLE_ID,getRoleId())
			.append(PROP_RESOURCE_ID,getResourceId())
			.toString();
	}
	@Override
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof RoleResource == false) return false;
		if(this == obj) return true;
		RoleResource other = (RoleResource)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
}
